package com.xxx.video.main.presenters;

import android.content.Context;

import androidx.annotation.NonNull;

import com.xxx.video.channel.beans.TypeInfoBean;
import com.xxx.video.commen.presenters.BasePresenter;
import com.xxx.video.commen.utils.ResponseUtils;
import com.xxx.video.network.listeners.CommonResponseListener;
import com.xxx.video.network.utils.NetWorkUtils;

public class HomeChannelListPresenter extends BasePresenter<IHomeChannelListView> {


    public HomeChannelListPresenter(@NonNull Context context, IHomeChannelListView baseView) {
        super(context, baseView);
    }

    /**
     * get type info
     *
     * @param id id
     */
    public void getTypeInfo(String id) {
        NetWorkUtils.getInstance().getTypeInfo(id, new CommonResponseListener<TypeInfoBean>() {

            @Override
            public void onSuccess(TypeInfoBean successOb, String result) {
                if (ResponseUtils.getInstance().isNoError(successOb)) {
                    if (getBaseView() != null) {
                        getBaseView().initData2View(successOb);
                    }
                }
            }

            @Override
            public void onFailure(Object failureObj) {
                if (getBaseView() != null) {
                    getBaseView().showRootLayoutStatus(3);
                }
            }
        });
    }
}
